<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<script type="text/javascript">
    var mallProductCategorySpecValList = (function(){
        var module = {
            init :function(){

            },
            update:function(){
                var rowsData = $('#mallProductCategorySpecValList').datagrid('getSelections');
                if (!rowsData || rowsData.length==0) {
                    tip('请选择编辑项目');
                    return;
                }
                if (rowsData.length>1) {
                    tip('请选择一条记录再编辑');
                    return;
                }
                var status = rowsData[0].status;
                if(status != 1){
                    createwindow("编辑","mallProductCategorySpecValController.do?addorupdate&id="+rowsData[0].id);
                }else{//判断有无被引用
                    $.ajax({
                        async : false,
                        cache : false,
                        type : 'get',
                        url : "mallProductCategorySpecValController.do?isuses&id="+rowsData[0].id,// 请求的action路径
                        success : function(data) {
                            var d = $.parseJSON(data);
                            if (!d.success) {
                                alertTip(d.msg,"提示");
                            }else{
                                createwindow("编辑","mallProductCategorySpecValController.do?addorupdate&id="+rowsData[0].id);
                            }
                        }
                    });
                }
            },
        }
        return module;
    })();
</script>
<div class="easyui-layout" fit="true">
  <div region="center" style="padding:0px;border:0px">
  <t:datagrid name="mallProductCategorySpecValList" title="规格值" pagination="false" actionUrl="mallProductCategorySpecValController.do?datagrid&specid=${specid}" idField="id" fit="true">
   <t:dgCol title="编号" field="id" hidden="true"></t:dgCol>
   <t:dgCol title="值" field="value"   width="120"></t:dgCol>
  <%-- <t:dgCol title="specid" field="specid"   width="120"></t:dgCol>--%>
   <t:dgCol title="创建人" field="createuserid"   width="120"></t:dgCol>
   <t:dgCol title="创建时间" field="createtime" formatter="yyyy-MM-dd hh:mm:ss"  width="120"></t:dgCol>
   <t:dgCol title="状态" field="status" replace="启用_1,禁用_0"  width="120"></t:dgCol>
   <t:dgCol title="操作" field="opt" width="100"></t:dgCol>
   <t:dgDelOpt title="删除" url="mallProductCategorySpecValController.do?del&id={id}" />
   <t:dgToolBar title="录入" icon="icon-add" url="mallProductCategorySpecValController.do?addorupdate&specid=${specid}" funname="add"></t:dgToolBar>
   <t:dgToolBar title="编辑" icon="icon-edit" url="mallProductCategorySpecValController.do?addorupdate" funname="mallProductCategorySpecValList.update"></t:dgToolBar>
   <t:dgToolBar title="查看" icon="icon-search" url="mallProductCategorySpecValController.do?addorupdate" funname="detail"></t:dgToolBar>
  </t:datagrid>
  </div>
 </div>